<script>
	import { getPrivileges } from '@/api/basic.js'
	export default {
		globalData: {
			isJump: true,

		},
		onLaunch: function({query}) {
			console.log('App Launch1',query)
		
				let data;
				//data = {
				// 	lang: "zh",
				// 	mobile: "17601301991",
				// 	statusBarHeight: "0",
				// 	token: "e708fea6-7c6c-41a1-875a-c0ba33c24591",
				// 	userId: '4141',
				// 	statusbottom: 0,
				// };
				// query.lang ='zh'
				data = {
					lang:   query.lang,
					mobile: query.mobile,
					statusBarHeight: query.statusBarHeight || 0,
					token: query.token || '',
					userId: query.userId || '',
					statusbottom: query.statusbottom || 0,
					version: query.version || '',
				}
				// data.lang = 'ru'
				
				this.$store.commit("setCommonData", data);
				this.$i18n.locale = data.lang;
				this.langR = data.lang;
				uni.setStorageSync("lang", data.lang);
				uni.setStorageSync("xzdToken", data.token);
				uni.setStorageSync("mobile", data.mobile);
				uni.setStorageSync("statusBarHeight", data.statusBarHeight);
				uni.setStorageSync("statusbottom", data.statusbottom);
				uni.setStorageSync("user_id", data.userId);
				uni.setStorageSync('version', data.version);


				this.getVipList()
				this.fixIOSWebViewHeight();




			// if (!!window.setParams) return;
			// window.setParams = (data) => {
			// 	this.$store.commit("setCommonData", data);
			// 	uni.setStorageSync("lang", data.lang);
			// 	uni.setStorageSync("xzdToken", data.token);
			// 	uni.setStorageSync("mobile", data.mobile);
			// 	uni.setStorageSync("statusbottom", data.statusbottom);
			// 	uni.setStorageSync("statusBarHeight", data.statusBarHeight);
			// 	this.$i18n.locale = data.lang;
		
			// }
		},
		methods:{
			fixIOSWebViewHeight(){
				// 判断 iOS 环境
				const isIOS = /iPhone|iPad|iPod/i.test(navigator.userAgent);
				if (isIOS) {
					document.body.style.height = '100vh';
				}

			},
			getVipList(){
				if (uni.getStorageSync('user_id') != 0 && !!uni.getStorageSync('user_id')){
					getPrivileges({
						user_id: uni.getStorageSync('user_id'),
					}).then(res=>{
						let list = res.data.data?.data;
						let level = res.data.data?.level;
						uni.setStorageSync('vipList',list);
						uni.setStorageSync('level',level || 0);
					})
				}
			},
		},
		onShow: function() {
			console.log('App Show1')
		},
		onHide: function() {
			console.log('App Hide1')
		},
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	@import '@/assets/common.scss';
	@import 'uview-ui/index.scss';

	/* #ifndef APP-NVUE */
	// 设置整个项目的背景色
	.shop_bottom .uni-tab__cart-sub-right {
		line-height: 1.2em;
	}
	page {
		background-color: #fff;
		height: 100%;
	}

	/* #endif */
	.example-info {
		font-size: 14px;
		color: #333;
		padding: 10px;
	}
	.phoneStxxxy {
		width: 80%;
		height: 76rpx;
		font-family: PingFang SC;
		font-weight: 400;
		font-size: 30rpx;
		line-height: 76rpx;
		letter-spacing: 0px;
		border: 2rpx solid #E9E9E9;
		border-radius: 500rpx;
		margin-top: 24rpx;
		text-align: center;
	}


	.model-vip {
		width: 100%;
		border-radius: 18px;
		background: rgba(0, 0, 0, 0.30);
		backdrop-filter: blur(9px);
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		color: #FFF;
		text-align: center;
		font-size: 34rpx;
		font-weight: 500;
		position: absolute;
		z-index: 100;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		.update {
			margin-bottom: 14rpx;
		}
	}
	.vh-100{
	height: 100vh;
}


.translatexxxxxx {
	width: 50rpx;
	height: 40rpx;
	margin-left: 10rpx;
}
</style>